{% extends 'layout.html' %}


{% block css %}
    <style>
        .not_required {
            color: rgba(128, 128, 128, 0.77);
        }
    </style>
{% endblock %}


{% block content %}

    <div class="panel panel-default">
        <div class="panel-heading">{{ title }}</div>
        <div class="panel-body">
            <form class="form-horizontal" method="post" novalidate>
                {% csrf_token %}
                {% for field in obj %}
                    <div class="form-group {% if field.errors %}has-error{% endif %}">
                        <label for="{{ field.id_for_label }}"
                               class="col-sm-3 control-label {% if not field.field.required %}not_required{% endif %}">{{ field.label }}</label>
                        <div class="col-sm-7">
                            {{ field }}
                            <span class="help-block">{{ field.errors.0 }}</span>
                        </div>
                    </div>
                {% endfor %}
                <p class="text-danger text-center"> {{ obj.non_field_errors.0 }} </p>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-9">
                        <button type="submit" class="btn btn-primary">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

{% endblock %}